<!--大小额贷记来账业务手工处理页面-->
<template>
    <div class="app-container">

        <h1>huduo</h1>

        <Ht-search-form v-show="showSearch" :dictMap="dictMap" :queryParams="queryParams" :outputQueryParams="queryParams"
            :formOptions="formOptions" :advOptions="[]" :labelWidth="85"></Ht-search-form>
        <ht-table ref="dataTable" :showSerialNumber="false" :multi-select="false" :dictMap="dictMap" :reqConfig="reqConfig"
            :queryParams="queryParams" :tableBindColumns="tableBindColumns" :opButtonList="opButtonList">
            <template v-slot:operate>
                <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
                    <template slot-scope="scope">
                        <ht-button-group :buttonList="[
                            {
                                label: '明细',
                                // permission: 'user:xxx:xxx',
                                // visible: scope.row.pkgno !== 'beps.122.001.01',
                                doFunc: () => {
                                    handleAction('details', scope.row);
                                },
                            },
                        ]" />
                    </template>
                </el-table-column>
            </template>
        </ht-table>
        <!-- 明细操作弹出框 -->
        <warning-setting ref="warningSettingDialog" :dictMap="dictMap" :formData.sync="formData"
            @editComplete="editComplete"></warning-setting>
    </div>
</template>
<script>
import {
    hvpsBepsCreditVostroQuery,
    hvpsBepsCreditVostroDetail,
} from "@/api/cnaps/beps/baseHandWork/hvpsBepsCreditVostroHdWk";
//import WarningSetting from "./components/warningSetting";
import { listPageMixin } from "@/libs/listPageMixin";
import { log } from "util";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";

export default {
    name: "HvpsBepsCreditVostroHdWk",
    mixins: [listPageMixin],
    // components: {
    //     WarningSetting,
    // },
    data() {
        return {
            reqConfig: hvpsBepsCreditVostroQuery,
            formOptions: [],
            //数据字典
            searchFormDictList: ["TXN_SYSCODE", "CURCD", "NON_STP_TYPE"],
            //  明细弹框数据
            // form表单字段
            formData: {
                data: {},
            },
            // 查询参数
            queryParams: {
                id: "",
                cpgdate: "",
                cpgdate2: "",
                workdate: "",
                workdate2: "",
                nstpRemarks: "",
            },
            opButtonList: () => {
                return [];
            },
            tableBindColumns: [
                {
                    label: `交易流水号`,
                    prop: "id",
                    width: "200",
                    sortable: false,
                },
                {
                    label: `CPG日期`,
                    prop: "cpgdate",
                    width: "150",
                    sortable: false,
                    type: "date",
                },
                {
                    label: `工作日期`,
                    prop: "workdate",
                    width: "150",
                    sortable: false,
                    type: "date",
                },
                {
                    label: `系统编号`,
                    prop: "sysCode",
                    dictCode: "TXN_SYSCODE",
                    sortable: false,
                },
                {
                    label: `报文类型`,
                    prop: "pkgno",
                    width: "300",
                    sortable: false,
                    formatter(row, text, index) {
                        return (
                            (row["pkgno"] === null || row["pkgno"] === undefined ? "" : row["pkgno"]) +
                            "-" +
                            (row["pkgnoDesc"] === null || row["pkgnoDesc"] === undefined ? "" : row["pkgnoDesc"])
                        );
                    },
                },
                {
                    label: `non-STP类型`,
                    prop: "nstpType",
                    width: "200",
                    dictCode: "NON_STP_TYPE",
                    sortable: false,
                },
                {
                    label: `业务类型`,
                    prop: "bizTypeCode",
                    width: "200",
                    sortable: false,
                    formatter(row, text, index) {
                        return (
                            (row["bizTypeCode"] === null || row["bizTypeCode"] === undefined ? "" : row["bizTypeCode"]) +
                            "-" +
                            (row["bizTypeCodeDesc"] === null || row["bizTypeCodeDesc"] === undefined ? "" : row["bizTypeCodeDesc"])
                        );
                    },
                },
                {
                    label: `金额`,
                    prop: "amount",
                    sortable: false,
                    type: "price",
                },
                {
                    label: `接收时间`,
                    prop: "rcvTime",
                    width: "150",
                    sortable: false,
                    type: "date",
                },
            ],
        };
    },
    mounted() {
        this.formOptions = [
            {
                type: "input",
                prop: "id",
                defaultAttr: {
                    size: "small",
                    label: "交易流水号",
                    placeholder: "请输入交易流水号",
                },
            },
            {
                type: "dates",
                nameObj: {
                    startTimeName: "cpgdate",
                    endTimeName: "cpgdate2",
                },
                defaultAttr: {
                    size: "small",
                    label: "CPG日期",
                    placeholder: ["请输入CPG日期开始", "请输入CPG日期结束"],
                    format: "yyyy-MM-dd",
                    valueFormat: "yyyyMMdd",
                },
            },
            {
                type: "dict",
                prop: "nstpRemarks",
                dict: "NON_STP_TYPE",
                defaultAttr: {
                    size: "small",
                    label: "non-STP原因",
                    placeholder: "non-STP原因",
                },
            },
            {
                type: "dates",
                nameObj: {
                    startTimeName: "workdate",
                    endTimeName: "workdate2",
                },
                defaultAttr: {
                    size: "small",
                    label: "工作日期",
                    placeholder: ["请输入工作日期开始", "请输入工作日期结束"],
                    format: "yyyy-MM-dd",
                    valueFormat: "yyyyMMdd",
                },
            },
        ];
    },
    methods: {
        editComplete(state) {
            if (state == true) {
                this.$refs.dataTable.doQuery();
            }
        },
        handleAction(type, row = {}) {
            switch (type) {
                case "details":
                    // 明细详情
                    hvpsBepsCreditVostroDetail({ id: row.id, bizTypeCode: row.bizTypeCode, pkgno: row.pkgno }).then((res) => {
                        this.formData = _.clone(res.result);
                       // this.$refs.warningSettingDialog.show();
                    });

                    break;
            }
        },
    },
};
</script>
<style>
.label-header-msg {
    font-weight: bold;
}
</style>
  